package com.example.demo.checkReport.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.checkReport.service.impl.CostServiceImpl;
import com.example.demo.common.ResponseData;

/**
 * <p>
 * VIEW 前端控制器
 * </p>
 *
 * @author beyong
 * @since 2021-05-29
 */
@RestController
@RequestMapping("/checkReport/cost")
@PreAuthorize("hasAnyAuthority('6')")
@CrossOrigin(origins = {"*"})
public class CostController {

	@Autowired
	private CostServiceImpl costServiceImpl;
	
	/**
	 * 根据条件 获取 成本核算 的信息
	 * @param purpose
	 * @param department
	 * @param year
	 * @param month
	 * @return
	 */
	@PostMapping("/getcost")
	public ResponseData getAllCostData(@RequestParam("purpose") String purpose, @RequestParam("department") String department,
			@RequestParam("year") String year, @RequestParam("month") String month) {
		
		return costServiceImpl.getCost(purpose, department, year, month);
	}
}

